package com.eastfair.certificate.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 用户填写的制证信息
 * </p>
 *
 * @author ligang
 * @date 2022-07-28
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "CertificateUserEndAuthStatusEnum", description = "最终审核状态#{WAIT:等待审核;CHECK:审核中;CHECK_SUCC:审核成功;CHECK_FAIL:审核失败;-枚举")
public enum CertificateUserEndAuthStatusEnum implements BaseEnum {

    /**
     * WAIT="等待审核"
     */
    WAIT("等待审核"),
    /**
     * CHECK="审核中"
     */
    CHECK("审核中"),
    /**
     * CHECK_SUCC="审核成功"
     */
    CHECK_SUCC("审核成功"),
    /**
     * CHECK_FAIL="审核失败"
     */
    CHECK_FAIL("审核失败"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static CertificateUserEndAuthStatusEnum match(String val, CertificateUserEndAuthStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static CertificateUserEndAuthStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(CertificateUserEndAuthStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "WAIT,CHECK,CHECK_SUCC,CHECK_FAIL", example = "WAIT")
    public String getCode() {
        return this.name();
    }

}
